// 静态属性，样式属性，剥离数据 多种屏幕尺寸都事先部署好
import echarts from 'echarts'
const staticOption = {
  tooltip: {},
  animationDurationUpdate: 1500,
  animationEasingUpdate: 'quinticInOut',
  color: ['#83e0ff', '#45f5ce', '#b158ff'],
  series: [
    {
      type: 'graph',
      layout: 'circular',
      focusNodeAdjacency: true,
      symbolSize: 50,
      roam: false,
      width: '70%',
      height: '70%',
      label: {
        normal: {
          show: true,
          fontSize: 16,
          color: '#fff',
          rich: {
            a: {
              lineHeight: 24,
              fontSize: 16,
              color: '#fff',
              align: 'center'
            }
          }
        }
      },
      lineStyle: {
        normal: {
          width: 4,
          curveness: 0.3,
          color: '#fcae00'
        }
      },
      data: [
        {
          name: 'Ai作业',
          symbolSize: 90,
          draggable: true,
          category: 1,
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#ff3744'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#ff7079'
              }
              ], false)
            }
          }
        }, {
          name: '综合素质评价系统',
          symbolSize: 120,
          label: {
            formatter: function () {
              return '{a|综合素质\n评价系统}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#d65738'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#f78367'
              }
              ], false)
            }
          },
          category: 1
        }, {
          name: '云选课-学生端',
          symbolSize: 90,
          category: 1,
          label: {
            formatter: function () {
              return '{a|云选课\n学生端}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#f27f22'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#ffc022'
              }
              ], false)
            }
          }
        }, {
          name: '云选课-老师端',
          symbolSize: 90,
          category: 0,
          label: {
            formatter: function () {
              return '{a|云选课\n老师端}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#3f8e2f'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#8ad18a'
              }
              ], false)
            }
          }
        }, {
          name: '教师成长档案',
          symbolSize: 90,
          category: 0,
          label: {
            formatter: function () {
              return '{a|教师\n成长档案}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#00917b'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#3ecdb7'
              }
              ], false)
            }
          }
        }, {
          name: '天闻ECO云开放平台',
          symbolSize: 130,
          category: 0,
          label: {
            formatter: function () {
              return '{a|天闻ECO\n云开放平台}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#297ecf'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#26d6fe'
              }
              ], false)
            }
          }
        }, {
          name: '教育云',
          category: 2,
          symbolSize: 90,
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#2446f2'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#669eff'
              }
              ], false)
            }
          }
        }, {
          name: '校比邻',
          symbolSize: 90,
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#523aca'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#7574ee'
              }
              ], false)
            }
          },
          category: 0
        }, {
          name: '德育管理系统',
          symbolSize: 90,
          label: {
            formatter: function () {
              return '{a|德育\n管理系统}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#523aca'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#7574ee'
              }
              ], false)
            }
          },
          category: 0
        }, {
          name: '考务管理系统',
          symbolSize: 90,
          label: {
            formatter: function () {
              return '{a|考务\n管理系统}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#523aca'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#7574ee'
              }
              ], false)
            }
          },
          category: 0
        }, {
          name: '数据机器人',
          symbolSize: 90,
          label: {
            formatter: function () {
              return '{a|数据\n机器人}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#523aca'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#7574ee'
              }
              ], false)
            }
          },
          category: 0
        }],
      // links: [],
      links: [
        {
          source: 'Ai作业',
          target: '天闻ECO云开放平台',
          value: 60,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
              // 0% 处的颜色
              offset: 0,
              color: '#fd4f61'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#fe8a9a'
            }
            ], false)
          }
        }, {
          source: 'Ai作业',
          target: '校比邻',
          value: 40,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
              // 0% 处的颜色
              offset: 0,
              color: '#fd4f61'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#fe8a9a'
            }
            ], false)
          }
        }, {
          source: 'Ai作业',
          target: '教育云',
          value: 30
        }, {
          source: '教育云',
          target: '天闻ECO云开放平台',
          value: 45,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#0ab5fd'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#26d6fe'
            }
            ], false)
          }
        }, {
          source: '综合素质评价系统',
          target: '天闻ECO云开放平台',
          value: 30,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#0ab5fd'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#26d6fe'
            }
            ], false)
          }
        }, {
          source: '综合素质评价系统',
          target: '校比邻',
          value: 35,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#ff8466'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#ffb69f'
            }
            ], false)
          }
        }, {
          source: '云选课-学生端',
          target: '天闻ECO云开放平台',
          value: 50,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#0ab5fd'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#26d6fe'
            }
            ], false)
          }
        }, {
          source: '云选课-老师端',
          target: '天闻ECO云开放平台',
          value: 30,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#0ab5fd'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#26d6fe'
            }
            ], false)
          }
        }, {
          source: '教师成长档案',
          target: '天闻ECO云开放平台',
          value: 20,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#0ab5fd'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#26d6fe'
            }
            ], false)
          }
        }, {
          source: '教师成长档案',
          target: '校比邻',
          value: 10,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#1ac2a6'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#48ddcc'
            }
            ], false)
          }
        }, {
          source: '校比邻',
          target: '天闻ECO云开放平台',
          value: 90,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#0ab5fd'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#26d6fe'
            }
            ], false)
          }
        }, {
          source: '校比邻',
          target: '教育云',
          value: 40,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#475ef0'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#8297f8'
            }
            ], false)
          }
        }, {
          source: '校比邻',
          target: 'Ai作业',
          value: 20,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#475ef0'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#8297f8'
            }
            ], false)
          }
        }, {
          source: '教育云',
          target: '校比邻',
          value: 25,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#007bff'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#00afff'
            }
            ], false)
          }
        }, {
          source: '教育云',
          target: 'Ai作业',
          value: 35,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#007bff'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#00afff'
            }
            ], false)
          }
        }]
    }
  ]
}

const staticOptionMid = {
  tooltip: {},
  animationDurationUpdate: 1500,
  animationEasingUpdate: 'quinticInOut',
  color: ['#83e0ff', '#45f5ce', '#b158ff'],
  series: [
    {
      type: 'graph',
      layout: 'circular',
      focusNodeAdjacency: true,
      symbolSize: 50,
      roam: false,
      width: '70%',
      height: '70%',
      label: {
        normal: {
          show: true,
          fontSize: 16,
          color: '#fff',
          rich: {
            a: {
              lineHeight: 24,
              fontSize: 16,
              color: '#fff',
              align: 'center'
            }
          }
        }
      },
      lineStyle: {
        normal: {
          width: 4,
          curveness: 0.3,
          color: '#fcae00'
        }
      },
      data: [
        {
          name: 'Ai作业',
          symbolSize: 90,
          value: 90,
          draggable: true,
          category: 1,
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#ff3744'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#ff7079'
              }
              ], false)
            }
          }
        }, {
          name: '综合素质评价系统',
          symbolSize: 120,
          value: 90,
          label: {
            formatter: function () {
              return '{a|综合素质\n评价系统}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#d65738'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#f78367'
              }
              ], false)
            }
          },
          category: 1
        }, {
          name: '云选课-学生端',
          symbolSize: 90,
          value: 90,
          category: 1,
          label: {
            formatter: function () {
              return '{a|云选课\n学生端}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#f27f22'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#ffc022'
              }
              ], false)
            }
          }
        }, {
          name: '云选课-老师端',
          symbolSize: 90,
          value: 90,
          category: 0,
          label: {
            formatter: function () {
              return '{a|云选课\n老师端}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#3f8e2f'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#8ad18a'
              }
              ], false)
            }
          }
        }, {
          name: '教师成长档案',
          symbolSize: 90,
          value: 90,
          category: 0,
          label: {
            formatter: function () {
              return '{a|教师\n成长档案}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#00917b'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#3ecdb7'
              }
              ], false)
            }
          }
        }, {
          name: '天闻ECO云开放平台',
          symbolSize: 130,
          value: 90,
          category: 0,
          label: {
            formatter: function () {
              return '{a|天闻ECO\n云开放平台}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#297ecf'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#26d6fe'
              }
              ], false)
            }
          }
        }, {
          name: '教育云',
          category: 2,
          value: 90,
          symbolSize: 90,
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#2446f2'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#669eff'
              }
              ], false)
            }
          }
        }, {
          name: '校比邻',
          value: 90,
          symbolSize: 90,
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#523aca'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#7574ee'
              }
              ], false)
            }
          },
          category: 0
        }, {
          name: '德育管理系统',
          value: 90,
          symbolSize: 90,
          label: {
            formatter: function () {
              return '{a|德育\n管理系统}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#523aca'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#7574ee'
              }
              ], false)
            }
          },
          category: 0
        }, {
          name: '考务管理系统',
          value: 90,
          symbolSize: 90,
          label: {
            formatter: function () {
              return '{a|考务\n管理系统}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#523aca'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#7574ee'
              }
              ], false)
            }
          },
          category: 0
        }, {
          name: '数据机器人',
          symbolSize: 90,
          value: 90,
          label: {
            formatter: function () {
              return '{a|数据\n机器人}'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                // 0% 处的颜色
                offset: 0,
                color: '#523aca'
              }, {
                // 100% 处的颜色
                offset: 1,
                color: '#7574ee'
              }
              ], false)
            }
          },
          category: 0
        }],
      // links: [],
      links: [
        {
          source: 'Ai作业',
          target: '天闻ECO云开放平台',
          value: 60,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
              // 0% 处的颜色
              offset: 0,
              color: '#fd4f61'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#fe8a9a'
            }
            ], false)
          }
        }, {
          source: 'Ai作业',
          target: '校比邻',
          value: 40,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
              // 0% 处的颜色
              offset: 0,
              color: '#fd4f61'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#fe8a9a'
            }
            ], false)
          }
        }, {
          source: 'Ai作业',
          target: '教育云',
          value: 30
        }, {
          source: '教育云',
          target: '天闻ECO云开放平台',
          value: 45,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#0ab5fd'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#26d6fe'
            }
            ], false)
          }
        }, {
          source: '综合素质评价系统',
          target: '天闻ECO云开放平台',
          value: 30,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#0ab5fd'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#26d6fe'
            }
            ], false)
          }
        }, {
          source: '综合素质评价系统',
          target: '校比邻',
          value: 35,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#ff8466'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#ffb69f'
            }
            ], false)
          }
        }, {
          source: '云选课-学生端',
          target: '天闻ECO云开放平台',
          value: 50,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#0ab5fd'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#26d6fe'
            }
            ], false)
          }
        }, {
          source: '云选课-老师端',
          target: '天闻ECO云开放平台',
          value: 30,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#0ab5fd'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#26d6fe'
            }
            ], false)
          }
        }, {
          source: '教师成长档案',
          target: '天闻ECO云开放平台',
          value: 20,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#0ab5fd'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#26d6fe'
            }
            ], false)
          }
        }, {
          source: '教师成长档案',
          target: '校比邻',
          value: 10,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#1ac2a6'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#48ddcc'
            }
            ], false)
          }
        }, {
          source: '校比邻',
          target: '天闻ECO云开放平台',
          value: 90,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#0ab5fd'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#26d6fe'
            }
            ], false)
          }
        }, {
          source: '校比邻',
          target: '教育云',
          value: 40,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#475ef0'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#8297f8'
            }
            ], false)
          }
        }, {
          source: '校比邻',
          target: 'Ai作业',
          value: 20,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#475ef0'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#8297f8'
            }
            ], false)
          }
        }, {
          source: '教育云',
          target: '校比邻',
          value: 25,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#007bff'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#00afff'
            }
            ], false)
          }
        }, {
          source: '教育云',
          target: 'Ai作业',
          value: 35,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              // 0% 处的颜色
              offset: 0,
              color: '#007bff'
            }, {
              // 100% 处的颜色
              offset: 1,
              color: '#00afff'
            }
            ], false)
          }
        }]
    }
  ]
}

// 备选颜色，有需求则进行循环
const colors = [
  (new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
    // 0% 处的颜色
    offset: 0,
    color: '#ff3744'
  }, {
    // 100% 处的颜色
    offset: 1,
    color: '#ff7079'
  }
  ], false)), (new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
    // 0% 处的颜色
    offset: 0,
    color: '#d65738'
  }, {
    // 100% 处的颜色
    offset: 1,
    color: '#f78367'
  }
  ], false)), (new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
    // 0% 处的颜色
    offset: 0,
    color: '#f27f22'
  }, {
    // 100% 处的颜色
    offset: 1,
    color: '#ffc022'
  }
  ], false)), (new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
    // 0% 处的颜色
    offset: 0,
    color: '#3f8e2f'
  }, {
    // 100% 处的颜色
    offset: 1,
    color: '#8ad18a'
  }
  ], false)), (new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
    // 0% 处的颜色
    offset: 0,
    color: '#00917b'
  }, {
    // 100% 处的颜色
    offset: 1,
    color: '#3ecdb7'
  }
  ], false)), (new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
    // 0% 处的颜色
    offset: 0,
    color: '#297ecf'
  }, {
    // 100% 处的颜色
    offset: 1,
    color: '#26d6fe'
  }
  ], false)), (new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
    // 0% 处的颜色
    offset: 0,
    color: '#2446f2'
  }, {
    // 100% 处的颜色
    offset: 1,
    color: '#669eff'
  }
  ], false)), (new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
    // 0% 处的颜色
    offset: 0,
    color: '#523aca'
  }, {
    // 100% 处的颜色
    offset: 1,
    color: '#7574ee'
  }
  ], false))
]
let colorIndex = 0

// 获取设备宽度
const screen = window.screen.width

class ChartFactory {
  constructor (additionalOptions) {
    // 根据屏幕宽度获取不同配置的echarts配置
    this.option = staticOption
    if (screen <= 1600) {
      this.option = staticOptionMid
    }
    // 下方复制属于浅拷贝，指向同个内存，针对可能有更改的需求，要进行一次清理
    this.clear()
    // 装配数据 必须使用箭头函数
    colorIndex = 0
    let lineStyleColor = {}
    additionalOptions.data.forEach((p1) => {
      this.option.series[0].data.push({
        name: p1.name,
        symbolSize: p1.symbolSize,
        draggable: true,
        category: 1,
        value: p1.value,
        label: {
          formatter: function () {
            return p1.label
          }
        },
        itemStyle: {
          normal: {
            color: colors[colorIndex]
          }
        }
      })
      lineStyleColor[p1.name] = colors[colorIndex]
      if (colorIndex >= 7) {
        colorIndex = 0
      } else {
        colorIndex += 1
      }
    })
    additionalOptions.links.forEach((p1) => {
      this.option.series[0].links.push({
        source: p1.source,
        target: p1.target,
        value: p1.value,
        lineStyle: {
          color: lineStyleColor[p1.source]
        }
      })
    })
  }

  // 清理方法，要将部署的新数据全部置空
  clear () {
    this.option.series[0].data = []
    this.option.series[0].links = []
  }

  getOption () {
    return this.option
  }
}

export { ChartFactory }
